#include "kmean.h"


kmean::kmean(void)
{
}

kmean::kmean(int len){
	for(int i = 0;i<len;++i){
		this->v.push_back( rand() % 10 + 1 );
	}
}

void kmean::cluster(){
	vector<int> centroid;
	for(int i = 0;i<this->k;i++){
		centroid.push_back( v.at( rand() % this->v.size()));    //random index of data
	}
	for(int i = 0; i<this->k; i++){
		;
	}
}

double kmean::dist(vector<int> &a, vector<int> &b){
	if(a.size() != b.size()){
		cerr<<"vector size differs in dist()"<<endl;
		return -1;
	}
	double res=0;
	for(int i = 0; i<a.size(); ++i){
		res+=(a.at(i)-b.at(i))^2;
	}
	res/=a.size();
	return res;
}
void kmean::setk(int k){
	this->k = k;
}


void kmean::ptvector(){
	for(int i=0;i<v.size();++i){
		cout<<v.at(i)<<endl;
	}
}


kmean::~kmean(void)
{
}
